Ext.define('TS.view.dilema.TagGrid' , {
	extend: 'TS.lib.Grid',
	alias : 'widget.dilemataggrid',
	store:'DilemaTag',
	border:true,
	//title:'Tagi',
	noPager:true,
	lbar:Factory.toolbar.search([
		Factory.btn._(null,function(){
			if(!(id = Util.fldVal('dilema->id')))
				return Factory.flyer.bad('Pytanie nie zostało jeszcze zapisane');
			
			Factory.winForm('dilematag',null,'simple');
			
			Util.fldVal('dilematag->#dilema_id',id);
		},{icon:URL.icon('add.png')})],
		function(btn){
			return [{
				name:'dilema_id',value:Util.fldVal('dilema->id')
			}]
		}
	//	[Factory.btn.edit('DilemaPoint')]
	),
	frame:false,
	//plugins:[Factory.plugin.edit()],
	listeners:{
		'itemdblclick':function(){
			!Util.form('dilematag') ? 
				Ext.create('TS.lib.Window',{
					width:400,
					items:[{xtype:'dilematagform'}]
				}) : 
				Util.f.clear('dilematag');
				
			return true;
		}
	},
	columns: [
	 	{xtype: 'rownumberer'},{
			header:'ID',
			hidden:true,
			dataIndex:'dilema_tag_id'
		},{
			header:'Tag',
			sortable:true,
			dataIndex:'tag_id',
			renderer:Factory.rend.dict(Dict.tag)
		},{
			header:'dilema_id',
			hidden:true,
			dataIndex:'dilema_id'
		}
	]
});